﻿using AutoMapper;
using API.Helpers;

namespace API.MappingProfiles
{
    internal class FoodOrderProfile : Profile
    {
        public override string ProfileName
        {
            get { return "FoodOrder"; }
        }

        protected override void Configure()
        {

            var mappingExpression = AutoMapperHelper.CreateMap(
                Mapper.CreateMap<EntityModels.FoodOrder, Models.FoodOrder>()
                    .ForMember(s => s.Id, m => m.MapFrom(s => s.FoodOrderId))
                    .ForMember(s => s.Created, m => m.MapFrom(s => s.Created))
                    .ForMember(s => s.Quantity, m => m.MapFrom(s => s.Quantity))
                    .ForMember(s => s.TableOrder, m => m.MapFrom(s => s.TableOrder))
                    .ForMember(s => s.Food, m => m.MapFrom(s => s.Food))
                    .ForMember(s => s.Note, m => m.MapFrom(s => s.Note))
                    .ForMember(s => s.IsDeleted, m => m.MapFrom(s => s.IsDeleted))
                );

            mappingExpression.Invoke();
            mappingExpression.Invoke().ReverseMap()

                .ForMember(s => s.FoodOrderId, m => m.MapFrom(s => s.Id))
                .ForMember(s => s.Created, m => m.MapFrom(s => s.Created))
                .ForMember(s => s.Quantity, m => m.MapFrom(s => s.Quantity))
                .ForMember(s => s.TableOrder, m => m.MapFrom(s => s.TableOrder))
                .ForMember(s => s.Food, m => m.MapFrom(s => s.Food))
                .ForMember(s => s.Note, m => m.MapFrom(s => s.Note))
                .ForMember(s => s.IsDeleted, m => m.MapFrom(s => s.IsDeleted));


        }
    }
}